//1.访问权限控制
const token = localStorage.getItem(('token'))
if(!token){
    location.href = '../login/index.html'
}

//2.设置个人信息
axios({
    url: '/v1_0/user/profile'
}).then(result =>{
    console.log(result);
    const username = result.data.name
    document.querySelector('.nickname').innerHTML  = username
})

//退出登录
document.querySelector('.quit').addEventListener('click', e=>{
    localStorage.clear()
    location.href = '../login/index.html'
})